﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUS.ISS.ARS.Service.Entity;
using NUS.ISS.ARS.BusinessFacade.Interface;
using NUS.ISS.ARS.BusinessFacade;
using NUS.ISS.ARS.Service;
using System.ServiceModel;


namespace ServiceHostConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            ServiceHost sh = null;
            try
            {
                Uri u = new Uri(@"http://localhost:8888/FlightBooking");
                sh = new ServiceHost(typeof(FlightBooking), u);
                BasicHttpBinding htpb = new BasicHttpBinding();
                sh.AddServiceEndpoint(typeof(IFlightBooking), htpb, "");

                sh.Open();

                Console.WriteLine("Flight Booking Service Host started. Press enter to stop the server.");
                Console.ReadLine();
            }
            catch
            {
                Console.WriteLine("Exception");
            }
            finally
            {
                if (sh.State == CommunicationState.Opened) sh.Close();
            }
        }
    }
}
